package cn.tedu.csmall.starter.test.bean;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 模拟spring boot 自定义一些业务类
 * 比如service controller
 */

@Component(value = "bean02")
// 读取属性，注入当前bean
@ConfigurationProperties(prefix = "tedu.class")
@Data
@EnableConfigurationProperties
public class Bean02 {
    // 读取的属性就是name 属性名称要保证和properties key值相同
    private String name;
    private String age;
    private List<String> boyfriends;

    public Bean02() {
        System.out.println("Bean02被spring容器加载了，通过扫描类加载的！");
    }

    @Override
    public String toString() {
        return "Bean02{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                ", boyfriends=" + boyfriends +
                '}';
    }
}
